package com.runa.rccprotocol.dto.langkabo;

import com.runa.protocol.dto.DtuReportAck;
import com.runa.protocol.util.ByteUtil;
import com.runa.protocol.util.UtilTime;

public class LKBAck extends DtuReportAck {

    public LKBAck(byte[] bytes) {
        data = bytes;
    }

    public LKBAck(String id) {
        data = new byte[18];
        data[0] = 0x68;
        data[1] = (byte) 0xc9;
        System.arraycopy(ByteUtil.hexStringToByteFlip(id), 0, data, 2, 7);
        System.arraycopy(ByteUtil.hexStringToByteFlip(UtilTime.getCurrentTime("yyyyMMddHHmmss")), 0, data, 9, 7);
        data[data.length-2] = ByteUtil.sum(data, 0, 16);
        data[data.length-1] = 0x16;
    }
}
